let path = require('path');

//日志根目录
let baseLogPath = path.resolve(__dirname, '../logs');

//错误日志目录
let errorPath = "/error";
//错误日志文件名
let errorFileName = "error";
//错误日志输出完整路径
let errorLogPath = baseLogPath + errorPath + "/" + errorFileName;


//响应日志目录
let responsePath = "/response";
//响应日志文件名
let responseFileName = "response";
//响应日志输出完整路径
let responseLogPath = baseLogPath + responsePath + "/" + responseFileName;

module.exports = {
    "appenders":{
        console : {
            type : 'console'
        },
        info : {
            type: 'file',
            filename: baseLogPath + "/shifone",
            maxLogSize: 4096000,
            backups: 4
        },
        error: {
            "category":"errorLogger",
            "type": "dateFile",
            "filename": errorLogPath,
            "alwaysIncludePattern":true,
            "pattern": "-yyyy-MM-dd.log",
            "path": errorPath
        },
        response: {
            "category":"resLogger",
            "type": "dateFile",
            "filename": responseLogPath,
            "alwaysIncludePattern":true,
            "pattern": "-yyyy-MM-dd.log",
            "path": responsePath,
        }
    },
    "categories" : {
        error: { appenders: ['error',"info","console"], level: 'error' },
        response: { appenders: ['response'], level: 'info' },
        default: { appenders: ["info","console"], level: 'debug' },
    }
}